﻿<?php

class vRegion
{
	public static function Generate($jobs, $show_actions)
	{
		
		$xtpl = new XTemplate('xtpl/regions.xtpl');
		if($show_actions)
		{
			$xtpl->parse('root.table.actions');
		}

		foreach ($jobs as $job) {
			$xtpl->assign('id', $job['id']);
			$xtpl->assign('title', $job['title']);
			$xtpl->assign('count', $job['workers']);
			if($show_actions)
				$xtpl->parse('root.table.erow');
			else
				$xtpl->parse('root.table.row');
		}
		$xtpl->parse('root.table');
		$xtpl->parse('root.dlg');
		return $xtpl->text('root.table').$xtpl->text('root.dlg');
	}

}